<template>
  <div>
    <tablePaging :tableItem="tableItem" :operationItem="operationItem" />
  </div>
</template>
<script setup>
import tablePaging from '@/views/common/component/table-paging'
import { onMounted, reactive, ref } from 'vue'
import {
  tableItem,
  operationItem
} from './const.js'
import { useRouter } from 'vue-router'
import {listDictItemByCode} from '@/api/config/dic'
const { proxy } = getCurrentInstance();
const router = useRouter()
function exportHandle() {
  proxy.download("/admin/customer/user/wechat/company/export", tableItem.pageInfo.request, `添加企业微信列表.xlsx`);
}
function initTableItem() {
  let menuArray = operationItem.menuArray
  let exportMenu = menuArray.find(item => item.code === 'export')
  exportMenu.handle = exportHandle
}
const initOptions = () => {
  let searchItemArray = operationItem.SearchItem
  let addSourceItem = searchItemArray.find(item => item.code == 'addSource')
  listDictItemByCode({typeCode: 'weComSourceCode'}).then(res => {
    addSourceItem.options = []
    const addSourceList = res.rows
    addSourceList.map(item => {
      addSourceItem.options.push({ label: item.name, value: item.id })
    })
  })
}

onMounted(() => {
  initTableItem()
  initOptions()
})
</script>

<style></style>
